import QtQuick 2.2

/*
* Canvas 画布
* 基本绘图模式 onPaint()
*/

/* 例子1
Canvas {
	width: 400;
	height: 240;

	onPaint: {
		var ctx = getContext("2d");
		ctx.lineWidth=2;
		ctx.strokeStyle = "red";
		ctx.fillStyle = "blue";
		ctx.beginPath();
		ctx.rect(100,80,120,80);
		ctx.fill();
		ctx.stroke();
	}
}
*/
// 例子2
Canvas {
	width: 400;
	height: 240;
	contextType: "2d";

	onPaint: {
		context.lineWidth = 2;
		context.strokeStyle = "red";
		context.fillStyle = "blue";
		context.beginPath();
		context.rect(100,80,120,80);
		context.fill();
		context.stroke();
	}
}
